package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.ShoppBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IShoppMapper extends BaseMapper<ShoppBean> {
    public List<ShoppBean> findByUser(Integer userId);
    @Select("SELECT SUM(p.p_perice * s.s_count) FROM t_shopp s,t_product p WHERE p.pk_productId=s.fk_productId AND fk_userId=#{userId};")
    @ResultType(Integer.class)
    public Integer computeShopp(Integer userId);
}
